package lock.runnable;

import java.util.concurrent.locks.ReentrantLock;

/**
 * @author jiangwz
 * @create 2019/7/10.
 */
public class TestRun implements Runnable {

    private int age;

    private ReentrantLock lock = new ReentrantLock();

    @Override
    public /*synchronized*/ void run() {
//        lock.lock();
        System.out.println("age = " + ++age);
//        lock.unlock();
    }

    public static void main(String[] args) {
        TestRun t = new TestRun();
        for (int i = 0; i < 100; i++) {
            new Thread(() -> t.run()).start();
        }
    }
}
